package eai.tp2.core.datamodel;

import java.util.Calendar;
import java.util.Date;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Simão
 */
public class Announcement {

    private String model;
    private String date;

    public Announcement(String model, Date date) {
        String day, month;

        this.model = model;
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);

        if (cal.get(Calendar.DAY_OF_MONTH) > 0 && cal.get(Calendar.DAY_OF_MONTH) < 10) {
            day = "0" + cal.get(Calendar.DAY_OF_MONTH);
        } else {
            day = ""+cal.get(Calendar.DAY_OF_MONTH);
        }

        if (cal.get(Calendar.MONTH) > 0 && cal.get(Calendar.MONTH) < 9) {
            month = "0" + (cal.get(Calendar.MONTH)+1);
        } else {
            month = ""+(cal.get(Calendar.MONTH)+1);
        }

        this.date = cal.get(Calendar.YEAR) + "-" + month + "-" + day;

    }

    public String getDate() {
        return date;
    }

    public void setDate(String date) {
        this.date = date;
    }

    public String getModel() {
        return model;
    }

    public void setModel(String model) {
        this.model = model;
    }
}
